﻿using System;
using System.Xml.Serialization;

namespace ApplicationSettingsManager
{
	[XmlRoot("tableStorageSettings")]
	[Serializable]
	public class TableStorageSettings
	{
		private string _districtsTableName = "DistrictsTable";
		private string _fileInfoTableName = "FileInfoTable";
		private string _appLayersTableName = "AppLayersTable";
		private string _censusGeometryTableName = "AllGeo10Table";
		private string _acsDataTableName = "ACSDataTable";
		private string _allDictionaryTableName = "AllDictionary10Table";
		private string _allDataTableName = "A11Data10Table";
		private string _dictionariesTableName = "DictionariesTable";
		private string _regionsTableName = "RegionsTable";
		private string _regionsZoomTableName = "RegionsZoomTable";

		/// <summary>
		/// AppLayersTableName Property (tl10AppLayers10)
		/// Gets or sets the name of the AppLayers table.
		/// </summary>
		public string AppLayersTableName
		{
			get { return _appLayersTableName; }
			set { _appLayersTableName = value; }
		}

		/// <summary>
		/// AllDictionaryTableName Property (tl10All10DataDictionary)
		/// </summary>
		/// <value>The name of all dictionary table.</value>
		public string AllDictionaryTableName
		{
			get { return _allDictionaryTableName; }
			set { _allDictionaryTableName = value; }
		}

		/// <summary>
		/// AllDataTableName Property (tl10All10Data
		/// </summary>
		/// <value>The name of all data table.</value>
		public string AllDataTableName
		{
			get { return _allDataTableName; }
			set { _allDataTableName = value; }
		}

		/// <summary>
		/// CensusGeometry Property (tl10All10Geo)
		/// </summary>
		public string CensusGeometryTableName
		{
			get { return _censusGeometryTableName; }
			set { _censusGeometryTableName = value; }
		}

		/// <summary>
		/// ACSDataTableName Property All ACS tables from SQL are in this container.
		/// </summary>
		/// <value>The name of the ACS data table.</value>
		public string ACSDataTableName
		{
			get { return _acsDataTableName; }
			set { _acsDataTableName = value; }
		}

		/// <summary>
		/// DistrictsTableName Property. (tl10DistrictPlanTypes10)
		/// Gets or sets the name of the districts table.
		/// </summary>
		/// <value>The name of the districts table.</value>
		public string DistrictsTableName
		{
			get { return _districtsTableName; }
			set { _districtsTableName = value; }
		}

		/// <summary>
		/// FileInfoTableName Property (tl10FileInfo10)
		/// Gets or sets the name of the file info table.
		/// </summary>
		/// <value>The name of the file info table.</value>
		public string FileInfoTableName
		{
			get { return _fileInfoTableName; }
			set { _fileInfoTableName = value; }
		}

		#region Aggregate tables

		/// <summary>
		/// DictionariesTableName Property This applies to all the dictionary tables
		/// which are partitioned by the table type (block, vtd, sldu, precint, etc.)
		/// </summary>
		public string DictionariesTableName
		{
			get { return _dictionariesTableName; }
			set { _dictionariesTableName = value; }
		}

		/// <summary>
		/// RegionsTableName Property This applies to all the dictionary tables
		/// which are partitioned by the table type (block, vtd, sldu, precint, etc.)
		/// </summary>
		public string RegionsTableName
		{
			get { return _regionsTableName; }
			set { _regionsTableName = value; }
		}

		/// <summary>
		/// RegionsZoomTableName Property This applies to all the dictionary tables
		/// which are partitioned by the table type (block, vtd, sldu, precint, etc.)
		/// </summary>
		public string RegionsZoomTableName
		{
			get { return _regionsZoomTableName; }
			set { _regionsZoomTableName = value; }
		}

		#endregion

		/// <summary>
		/// Sets the value.
		/// </summary>
		/// <param name="settingName">Name of the setting.</param>
		/// <param name="value">The value.</param>
		public void SetValue(string settingName, string value)
		{
			switch (settingName)
			{
				case "AllDictionaryTableName":
					_allDictionaryTableName = value;
					break;
				case "AllDataTableName":
					_allDataTableName = value;
					break;
				case "CensusGeometryTableName":
					_censusGeometryTableName = value;
					break;
				case "ACSDataTableName":
					_acsDataTableName = value;
					break;
				case "DistrictsTableName":
					_districtsTableName = value;
					break;
				case "FileInfoTableName":
					_fileInfoTableName = value;
					break;
				case "AppLayersTableName":
					_appLayersTableName = value;
					break;
				case "DictionariesTableName":
					_dictionariesTableName = value;
					break;
				case "RegionsTableName":
					_regionsTableName = value;
					break;
				case "RegionsZoomTableName":
					_regionsZoomTableName = value;
					break;
			}

		}
	}
}
